#include<iostream>
#include <json/json.h>

using namespace std;

int main(){
    Json::Reader reader;
    string value = "{\n"
                   "    \"username\": \"lin\",\n"
                   "    \"password\": \"123456\"\n"
                   "}";
    Json::Value root;
    reader.parse(value, root);
    std::cout << root["username"].asString() << std::endl;
    std::cout << root["password"].asString() << std::endl;
    root["sex"] = "男";
    std::cout << root.toStyledString() << std::endl;
}

// https://www.cnblogs.com/__t udou__/p/14957646.html
// 具体操作参照